package com.igeek.health.config;

import com.igeek.health.interceptor.AuthInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @Author fengqq
 * @Description WebMVC配置
 * @Date 2024/9/13  10:44
 */
@Configuration
public class WebMVCConfig  {

    @Autowired
    private AuthInterceptor authInterceptor;
    @Bean
    public WebMvcConfigurer webMvcConfigurer(){
        return new WebMvcConfigurer() {
            @Override
            public void addInterceptors(InterceptorRegistry registry) {
                registry.addInterceptor(authInterceptor)
                        .addPathPatterns("/app/member/**")  //拦截路径
                        .excludePathPatterns("/app/member/login","/app/setmeal/**","/app/validateCode/**","/app/order/submit");  //排除路径
            }
        };
    }


}
